<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CrateInvoiceTable extends Migration
{

//idcode: "91510107MA6CMCDF73"   个人=纳税人识别号 公司=纳税人识别号
//invoice_id: "15018"
//invoice_info: ""
//invoice_type: "2"     //1个人  2增值税普通发票   3增值税专用发票
//receiver_address: "一环路南二段17号6楼6027"            //收票人地址

//receiver_county: "武侯区"                             //收票人所在区
//receiver_county_id: "510107"
//receiver_city: "成都市"                               //收票人城市
//receiver_city_id: "510100"
//receiver_province: "四川省"                             //收票人省份
//receiver_province_id: "510000"
//receiver_email: ""
//receiver_fullname: "童树伟"                           //收票人姓名
//receiver_mobile: "13668221543"                                  //收票人电话
//register_address: "成都市武侯区一环路南二段1号一栋10层18号"         // 注册地址
//register_bank: "华夏银行股份有限公司成都青羊支行"                 //开户银行
//register_bank_num: "11352000000210133"                //银行账户
//register_phone: "02885355303"          // 注册电话
//title: "成都映梵科技有限公司"   //单位名称

    public function up()
    {
        //发票信息
        Schema::create('invoice', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->tinyInteger('invoice_type')->comment('1个人  2增值税普通发票   3增值税专用发票');
            $table->tinyInteger('invoice_content_type')->comment('发票内容 1:商品明细 2:网络服务费');
            $table->unsignedDecimal('invoice_amount',10,2)->comment('开票金额');
            $table->string('invoice_id_num')->default(0)-> comment('证件号码 1:个人=身份证号 2:公司=纳税人识别号');
            $table->string('invoice_title')->nullable()-> comment('抬头');
            $table->string('register_address')->nullable()-> comment('注册地址');
            $table->string('register_tel')->nullable()-> comment('注册电话');
            $table->string('register_bank')->nullable()-> comment('开户银行');
            $table->string('register_bank_num')->nullable()-> comment('开户行账户');
            $table->string('receiver_name')->nullable()-> comment('收票人姓名');
            $table->string('receiver_email')->nullable()-> comment('收票人邮箱');
            $table->string('receiver_mobile')->nullable()-> comment('收票人电话');
            $table->string('receiver_address')->nullable()-> comment('收票人地址');
            $table->string('invoice_code')->nullable()-> comment('发票代码');
            $table->string('invoice_number')->nullable()-> comment('发票号码');
            $table->string('invoice_img')->nullable()-> comment('发票图片');
            $table->tinyInteger('status')->default(0)-> comment('开票状态 0:申请 1:通过 2:驳回');
            $table->timestamp('email_send_time')->nullable()-> comment('邮件发送时间');
            $table->string('remarks')->nullable()->comment('备注');
            $table->timestamps();
        });

    }

    public function down()
    {
        Schema::dropIfExists('invoice');
    }
}
